home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Highpass.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  3.2 KB  |  124 lines

  1. /*
  2. ** $VER: Highpass.ieb 1.1, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten 
  5. ** 25/1 1997 Stockholm/Sweden
  6. **
  7. ** Apply highpass to image.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.   
  41.   MaskWidth=5 ; MaskHeight=5
  42.                               
  43.   if command ~= '' then parse var command MaskWidth MaskHeight '#'CalcType
  44.  
  45.   'IE_TO_FRONT'
  46.  
  47.   form = 'FORM "Highpass" " OK | Cancel "',
  48.   ' INTEGER,"Mask width",1,25,'MaskWidth',SLIDER',
  49.   ' INTEGER,"Mask width",1,25,'MaskHeight',SLIDER'
  50.  
  51.   if command = '' then do  
  52.     form = form||' CYCLE,"Type:","Absolute|Scale|NegClip|PosClip",0'
  53.     
  54.     form
  55.     parse var result ok MaskWidth MaskHeight CalcType
  56.     if ok = 0 then return '<ERROR>'
  57.  
  58.     select
  59.       when CalcType = 0 then CalcType = 'ABSOLUTE'
  60.       when CalcType = 1 then CalcType = 'SCALE'
  61.       when CalcType = 2 then CalcType = 'CLIPNEG'
  62.       when CalcType = 3 then CalcType = 'CLIPPOS'
  63.     end
  64.   end
  65.   else do
  66.     form
  67.     parse var result ok MaskWidth MaskHeight
  68.     CalcType = 'none'
  69.   end
  70.  
  71.   back = MaskWidth MaskHeight '#'CalcType
  72. return back
  73.  
  74. /* Required "Process_image" procedure  ------------------------------- */
  75.  
  76. process_image:
  77.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  78.   parse var options MaskWidth MaskHeight '#'CalcType
  79.  
  80.   'OPEN' '"'src_image'"' '24'
  81.   if (RC ~= 0) then do
  82.     'IE_TO_FRONT'
  83.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  84.     return '<ERROR>'
  85.   end
  86.   else LoadImage = result
  87.  
  88.   'HIGHPASS' LoadImage MaskWidth MaskHeight CalcType
  89.   OutputImage = result
  90.   'CLOSE' LoadImage
  91.   
  92.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  93.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  94.   if (RC ~= 0) then do
  95.     'IE_TO_FRONT'
  96.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  97.     return '<ERROR>'
  98.   end
  99.   'CLOSE' OutputImage
  100.  
  101.   back = 'OK'
  102. return back
  103.  
  104. /* Internal procedures  ---------------------------------------------- */
  105.  
  106. /*******************************************************************/
  107. /* This is where control goes when an error code is returned by IE */
  108. /* It puts up a message saying what happened and on which line     */
  109. /*******************************************************************/
  110.  
  111. error:
  112. if RC=5 then do
  113.     IE_TO_FRONT
  114.     LAST_ERROR
  115.     'REQUEST "'||RESULT||'"'
  116. end
  117. else do
  118.     IE_TO_FRONT
  119.     LAST_ERROR
  120.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  121. end
  122.  
  123. return '<ERROR>'
  124.